package com.sas.dao.impl;

import java.util.List;
import org.springframework.stereotype.Repository;
import com.sas.dao.BaseDao;
import com.sas.dao.ResourcesDao;
import com.sas.entity.Resources;

/**
 *资源dao 
 *2017-11-20
 *胡其安
 */
@Repository("resourcesDao")
public class ResourcesDaoImpl extends BaseDao implements ResourcesDao {
	
	/**
	 * 查询所有权限资源
	 */
	@Override
	public List<Resources> select_resources_all(Resources resources) throws Exception {
		List<Resources> temp_resources=getSqlSession().selectList("select_resources_by_all");
		return temp_resources;
	}
	
	/**
	 * 根据用户id查询资源
	 */
	@Override
	public List<Resources> select_resources_by_userid(Resources resources)
			throws Exception {
		List<Resources> temp_resources=getSqlSession().selectList("resources.select_resources_by_userid_1",resources);
		return temp_resources;
	}
	/**
	 * 根据用户id删除权限资源
	 */
	@Override
	public int deleteResourcesByUserid(Resources resources) throws Exception {
		int count=getSqlSession().delete("delete_permission_by_userid",resources);
		return count;
	}

	/**
	 * 插入权限资源
	 */
	@Override
	public void insertResources(Resources resources) throws Exception {
		getSqlSession().insert("insert_permission",resources);
	}


}
